if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgActiveProductsFedaratedSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgActiveProductsFedaratedSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgActiveProductsFedaratedInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgActiveProductsFedaratedInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgActiveProductsFedaratedUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgActiveProductsFedaratedUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgActiveProductsFedaratedDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgActiveProductsFedaratedDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgActiveProductsFedaratedSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgActiveProductsFedaratedSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgActiveProductsFedaratedSelect
(
@ProductID	INT = NULL
)
AS

IF @ProductID IS NULL BEGIN
	SELECT	[ProductID], [ProductName]
	FROM [ActiveProductsFedarated]
END ELSE BEGIN
	SELECT	[ProductID], [ProductName]
	FROM [ActiveProductsFedarated]
	WHERE 
	[ProductID] = @ProductID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgActiveProductsFedaratedInsert
(
@ProductName	NVARCHAR(40))
AS
INSERT [ActiveProductsFedarated]
	([ProductName])
VALUES
(@ProductName)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgActiveProductsFedaratedUpdate
(
@ProductID	INT, 
@ProductName	NVARCHAR(40)
)
AS
UPDATE [ActiveProductsFedarated]
SET	[ProductName] = @ProductName
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgActiveProductsFedaratedDelete
(
@ProductID	INT
)
AS
DELETE FROM [ActiveProductsFedarated]
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgAddressSplitSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgAddressSplitSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgAddressSplitInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgAddressSplitInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgAddressSplitUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgAddressSplitUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgAddressSplitDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgAddressSplitDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgAddressSplitSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgAddressSplitSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgAddressSplitSelect
(
@ID	INT = NULL
)
AS

IF @ID IS NULL BEGIN
	SELECT	[ID], [Address], [City], [ContactType], [Country], [PostalCode],
			[Region]
	FROM [AddressSplit]
END ELSE BEGIN
	SELECT	[ID], [Address], [City], [ContactType], [Country], [PostalCode],
			[Region]
	FROM [AddressSplit]
	WHERE 
	[ID] = @ID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgAddressSplitInsert
(
@ID	INT,
@Address	NVARCHAR(60) = null,
@City	NVARCHAR(15) = null,
@ContactType	NVARCHAR(50) = null,
@Country	NVARCHAR(15) = null,
@PostalCode	NVARCHAR(50) = null,
@Region	NVARCHAR(15) = null)
AS
INSERT [AddressSplit]
	([Address], [City], [ContactType], [Country], [PostalCode], [Region])
VALUES
(@Address, @City, @ContactType, @Country, @PostalCode, @Region)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgAddressSplitUpdate
(
@ID	INT, 
@Address	NVARCHAR(60) = null, 
@City	NVARCHAR(15) = null, 
@ContactType	NVARCHAR(50) = null, 
@Country	NVARCHAR(15) = null, 
@PostalCode	NVARCHAR(50) = null, 
@Region	NVARCHAR(15) = null
)
AS
UPDATE [AddressSplit]
SET	[Address] = @Address, 
	[City] = @City, 
	[ContactType] = @ContactType, 
	[Country] = @Country, 
	[PostalCode] = @PostalCode, 
	[Region] = @Region
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgAddressSplitDelete
(
@ID	INT
)
AS
DELETE FROM [AddressSplit]
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseContactSplitSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseContactSplitSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseContactSplitInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseContactSplitInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseContactSplitUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseContactSplitUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseContactSplitDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseContactSplitDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseContactSplitSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseContactSplitSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseContactSplitSelect
(
@ID	INT = NULL
)
AS

IF @ID IS NULL BEGIN
	SELECT	[ID], [CompanyName], [ContactName], [ContactType], [Phone]
	FROM [BaseContactSplit]
END ELSE BEGIN
	SELECT	[ID], [CompanyName], [ContactName], [ContactType], [Phone]
	FROM [BaseContactSplit]
	WHERE 
	[ID] = @ID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseContactSplitInsert
(
@ID	INT,
@CompanyName	NVARCHAR(40),
@ContactName	NVARCHAR(30) = null,
@ContactType	NVARCHAR(50) = null,
@Phone	NVARCHAR(24) = null)
AS
INSERT [BaseContactSplit]
	([CompanyName], [ContactName], [ContactType], [Phone])
VALUES
(@CompanyName, @ContactName, @ContactType, @Phone)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseContactSplitUpdate
(
@ID	INT, 
@CompanyName	NVARCHAR(40), 
@ContactName	NVARCHAR(30) = null, 
@ContactType	NVARCHAR(50) = null, 
@Phone	NVARCHAR(24) = null
)
AS
UPDATE [BaseContactSplit]
SET	[CompanyName] = @CompanyName, 
	[ContactName] = @ContactName, 
	[ContactType] = @ContactType, 
	[Phone] = @Phone
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseContactSplitDelete
(
@ID	INT
)
AS
DELETE FROM [BaseContactSplit]
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseProductsFedaratedSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseProductsFedaratedSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseProductsFedaratedInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseProductsFedaratedInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseProductsFedaratedUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseProductsFedaratedUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseProductsFedaratedDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseProductsFedaratedDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgBaseProductsFedaratedSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgBaseProductsFedaratedSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseProductsFedaratedSelect
(
@ProductID	INT = NULL
)
AS

IF @ProductID IS NULL BEGIN
	SELECT	[ProductID], [ProductName]
	FROM [BaseProductsFedarated]
END ELSE BEGIN
	SELECT	[ProductID], [ProductName]
	FROM [BaseProductsFedarated]
	WHERE 
	[ProductID] = @ProductID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseProductsFedaratedInsert
(
@ProductID	INT,
@ProductName	NVARCHAR(40))
AS
INSERT [BaseProductsFedarated]
	([ProductName])
VALUES
(@ProductName)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseProductsFedaratedUpdate
(
@ProductID	INT, 
@ProductName	NVARCHAR(40)
)
AS
UPDATE [BaseProductsFedarated]
SET	[ProductName] = @ProductName
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgBaseProductsFedaratedDelete
(
@ProductID	INT
)
AS
DELETE FROM [BaseProductsFedarated]
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCategoriesSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCategoriesSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCategoriesInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCategoriesInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCategoriesUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCategoriesUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCategoriesDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCategoriesDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCategoriesSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCategoriesSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCategoriesSelect
(
@CategoryID	INT = NULL
)
AS

IF @CategoryID IS NULL BEGIN
	SELECT	[CategoryID], [CategoryName], [Description], [Picture]
	FROM [Categories]
END ELSE BEGIN
	SELECT	[CategoryID], [CategoryName], [Description], [Picture]
	FROM [Categories]
	WHERE 
	[CategoryID] = @CategoryID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCategoriesInsert
(
@CategoryName	NVARCHAR(15),
@Description	NTEXT = null,
@Picture	IMAGE = null)
AS
INSERT [Categories]
	([CategoryName], [Description], [Picture])
VALUES
(@CategoryName, @Description, @Picture)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCategoriesUpdate
(
@CategoryID	INT, 
@CategoryName	NVARCHAR(15), 
@Description	NTEXT = null, 
@Picture	IMAGE = null
)
AS
UPDATE [Categories]
SET	[CategoryName] = @CategoryName, 
	[Description] = @Description, 
	[Picture] = @Picture
WHERE 
[CategoryID] = @CategoryID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCategoriesDelete
(
@CategoryID	INT
)
AS
DELETE FROM [Categories]
WHERE 
[CategoryID] = @CategoryID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactNameSplitSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactNameSplitSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactNameSplitInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactNameSplitInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactNameSplitUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactNameSplitUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactNameSplitDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactNameSplitDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactNameSplitSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactNameSplitSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactNameSplitSelect
(
@ID	INT = NULL
)
AS

IF @ID IS NULL BEGIN
	SELECT	[ID], [ContactType], [Fax], [Name], [Title]
	FROM [ContactNameSplit]
END ELSE BEGIN
	SELECT	[ID], [ContactType], [Fax], [Name], [Title]
	FROM [ContactNameSplit]
	WHERE 
	[ID] = @ID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactNameSplitInsert
(
@ID	INT,
@ContactType	NVARCHAR(50) = null,
@Fax	NVARCHAR(24) = null,
@Name	NVARCHAR(30) = null,
@Title	NVARCHAR(30) = null)
AS
INSERT [ContactNameSplit]
	([ContactType], [Fax], [Name], [Title])
VALUES
(@ContactType, @Fax, @Name, @Title)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactNameSplitUpdate
(
@ID	INT, 
@ContactType	NVARCHAR(50) = null, 
@Fax	NVARCHAR(24) = null, 
@Name	NVARCHAR(30) = null, 
@Title	NVARCHAR(30) = null
)
AS
UPDATE [ContactNameSplit]
SET	[ContactType] = @ContactType, 
	[Fax] = @Fax, 
	[Name] = @Name, 
	[Title] = @Title
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactNameSplitDelete
(
@ID	INT
)
AS
DELETE FROM [ContactNameSplit]
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactsSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactsSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactsInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactsInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactsUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactsUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactsDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactsDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgContactsSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgContactsSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactsSelect
(
@ContactID	INT = NULL
)
AS

IF @ContactID IS NULL BEGIN
	SELECT	[ContactID], [Address], [City], [CompanyName], [ContactName],
			[ContactTitle], [ContactType], [Country], [Extension],
			[Fax], [HomePage], [Phone], [Photo], [PhotoPath], [PostalCode],
			[Region]
	FROM [Contacts]
END ELSE BEGIN
	SELECT	[ContactID], [Address], [City], [CompanyName], [ContactName],
			[ContactTitle], [ContactType], [Country], [Extension],
			[Fax], [HomePage], [Phone], [Photo], [PhotoPath], [PostalCode],
			[Region]
	FROM [Contacts]
	WHERE 
	[ContactID] = @ContactID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactsInsert
(
@Address	NVARCHAR(60) = null,
@City	NVARCHAR(15) = null,
@CompanyName	NVARCHAR(40),
@ContactName	NVARCHAR(30) = null,
@ContactTitle	NVARCHAR(30) = null,
@ContactType	NVARCHAR(50) = null,
@Country	NVARCHAR(15) = null,
@Extension	NVARCHAR(4) = null,
@Fax	NVARCHAR(24) = null,
@HomePage	NTEXT = null,
@Phone	NVARCHAR(24) = null,
@Photo	IMAGE = null,
@PhotoPath	NVARCHAR(255) = null,
@PostalCode	NVARCHAR(10) = null,
@Region	NVARCHAR(15) = null)
AS
INSERT [Contacts]
	([Address], [City], [CompanyName], [ContactName], [ContactTitle], [ContactType], [Country], [Extension], [Fax], [HomePage], [Phone], [Photo], [PhotoPath], [PostalCode], [Region])
VALUES
(@Address, @City, @CompanyName, @ContactName, @ContactTitle, @ContactType, @Country, @Extension, @Fax, @HomePage, @Phone, @Photo, @PhotoPath, @PostalCode, @Region)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactsUpdate
(
@ContactID	INT, 
@Address	NVARCHAR(60) = null, 
@City	NVARCHAR(15) = null, 
@CompanyName	NVARCHAR(40), 
@ContactName	NVARCHAR(30) = null, 
@ContactTitle	NVARCHAR(30) = null, 
@ContactType	NVARCHAR(50) = null, 
@Country	NVARCHAR(15) = null, 
@Extension	NVARCHAR(4) = null, 
@Fax	NVARCHAR(24) = null, 
@HomePage	NTEXT = null, 
@Phone	NVARCHAR(24) = null, 
@Photo	IMAGE = null, 
@PhotoPath	NVARCHAR(255) = null, 
@PostalCode	NVARCHAR(10) = null, 
@Region	NVARCHAR(15) = null
)
AS
UPDATE [Contacts]
SET	[Address] = @Address, 
	[City] = @City, 
	[CompanyName] = @CompanyName, 
	[ContactName] = @ContactName, 
	[ContactTitle] = @ContactTitle, 
	[ContactType] = @ContactType, 
	[Country] = @Country, 
	[Extension] = @Extension, 
	[Fax] = @Fax, 
	[HomePage] = @HomePage, 
	[Phone] = @Phone, 
	[Photo] = @Photo, 
	[PhotoPath] = @PhotoPath, 
	[PostalCode] = @PostalCode, 
	[Region] = @Region
WHERE 
[ContactID] = @ContactID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgContactsDelete
(
@ContactID	INT
)
AS
DELETE FROM [Contacts]
WHERE 
[ContactID] = @ContactID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerCustomerDemoSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerCustomerDemoSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerCustomerDemoInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerCustomerDemoInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerCustomerDemoUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerCustomerDemoUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerCustomerDemoDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerCustomerDemoDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerCustomerDemoSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerCustomerDemoSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerCustomerDemoSelect
(
@CustomerCustomerDemoID	INT = NULL
)
AS

IF @CustomerCustomerDemoID IS NULL BEGIN
	SELECT	[CustomerCustomerDemoID], [CustomerID], [CustomerTypeID]
	FROM [CustomerCustomerDemo]
END ELSE BEGIN
	SELECT	[CustomerCustomerDemoID], [CustomerID], [CustomerTypeID]
	FROM [CustomerCustomerDemo]
	WHERE 
	[CustomerCustomerDemoID] = @CustomerCustomerDemoID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerCustomerDemoInsert
(
@CustomerID	NCHAR(5),
@CustomerTypeID	NCHAR(10))
AS
INSERT [CustomerCustomerDemo]
	([CustomerID], [CustomerTypeID])
VALUES
(@CustomerID, @CustomerTypeID)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerCustomerDemoUpdate
(
@CustomerCustomerDemoID	INT, 
@CustomerID	NCHAR(5), 
@CustomerTypeID	NCHAR(10)
)
AS
UPDATE [CustomerCustomerDemo]
SET	[CustomerID] = @CustomerID, 
	[CustomerTypeID] = @CustomerTypeID
WHERE 
[CustomerCustomerDemoID] = @CustomerCustomerDemoID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerCustomerDemoDelete
(
@CustomerCustomerDemoID	INT
)
AS
DELETE FROM [CustomerCustomerDemo]
WHERE 
[CustomerCustomerDemoID] = @CustomerCustomerDemoID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerDemographicsSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerDemographicsSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerDemographicsInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerDemographicsInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerDemographicsUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerDemographicsUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerDemographicsDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerDemographicsDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomerDemographicsSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomerDemographicsSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerDemographicsSelect
(
@CustomerTypeID	NCHAR(10) = NULL
)
AS

IF @CustomerTypeID IS NULL BEGIN
	SELECT	[CustomerTypeID], [CustomerDesc]
	FROM [CustomerDemographics]
END ELSE BEGIN
	SELECT	[CustomerTypeID], [CustomerDesc]
	FROM [CustomerDemographics]
	WHERE 
	[CustomerTypeID] = @CustomerTypeID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerDemographicsInsert
(
@CustomerTypeID	NCHAR(10),
@CustomerDesc	NTEXT = null)
AS
INSERT [CustomerDemographics]
	([CustomerDesc])
VALUES
(@CustomerDesc)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerDemographicsUpdate
(
@CustomerTypeID	NCHAR(10), 
@CustomerDesc	NTEXT = null
)
AS
UPDATE [CustomerDemographics]
SET	[CustomerDesc] = @CustomerDesc
WHERE 
[CustomerTypeID] = @CustomerTypeID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomerDemographicsDelete
(
@CustomerTypeID	NCHAR(10)
)
AS
DELETE FROM [CustomerDemographics]
WHERE 
[CustomerTypeID] = @CustomerTypeID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomersSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomersSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomersInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomersInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomersUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomersUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomersDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomersDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgCustomersSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgCustomersSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomersSelect
(
@CustomerID	NCHAR(5) = NULL
)
AS

IF @CustomerID IS NULL BEGIN
	SELECT	[CustomerID], [Address], [City], [CompanyName], [ContactName],
			[ContactTitle], [Country], [Fax], [Phone], [PostalCode],
			[Region]
	FROM [Customers]
END ELSE BEGIN
	SELECT	[CustomerID], [Address], [City], [CompanyName], [ContactName],
			[ContactTitle], [Country], [Fax], [Phone], [PostalCode],
			[Region]
	FROM [Customers]
	WHERE 
	[CustomerID] = @CustomerID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomersInsert
(
@CustomerID	NCHAR(5),
@Address	NVARCHAR(60) = null,
@City	NVARCHAR(15) = null,
@CompanyName	NVARCHAR(40),
@ContactName	NVARCHAR(30) = null,
@ContactTitle	NVARCHAR(30) = null,
@Country	NVARCHAR(15) = null,
@Fax	NVARCHAR(24) = null,
@Phone	NVARCHAR(24) = null,
@PostalCode	NVARCHAR(10) = null,
@Region	NVARCHAR(15) = null)
AS
INSERT [Customers]
	([Address], [City], [CompanyName], [ContactName], [ContactTitle], [Country], [Fax], [Phone], [PostalCode], [Region])
VALUES
(@Address, @City, @CompanyName, @ContactName, @ContactTitle, @Country, @Fax, @Phone, @PostalCode, @Region)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomersUpdate
(
@CustomerID	NCHAR(5), 
@Address	NVARCHAR(60) = null, 
@City	NVARCHAR(15) = null, 
@CompanyName	NVARCHAR(40), 
@ContactName	NVARCHAR(30) = null, 
@ContactTitle	NVARCHAR(30) = null, 
@Country	NVARCHAR(15) = null, 
@Fax	NVARCHAR(24) = null, 
@Phone	NVARCHAR(24) = null, 
@PostalCode	NVARCHAR(10) = null, 
@Region	NVARCHAR(15) = null
)
AS
UPDATE [Customers]
SET	[Address] = @Address, 
	[City] = @City, 
	[CompanyName] = @CompanyName, 
	[ContactName] = @ContactName, 
	[ContactTitle] = @ContactTitle, 
	[Country] = @Country, 
	[Fax] = @Fax, 
	[Phone] = @Phone, 
	[PostalCode] = @PostalCode, 
	[Region] = @Region
WHERE 
[CustomerID] = @CustomerID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgCustomersDelete
(
@CustomerID	NCHAR(5)
)
AS
DELETE FROM [Customers]
WHERE 
[CustomerID] = @CustomerID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgDiscontinuedProductsFedaratedSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgDiscontinuedProductsFedaratedSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgDiscontinuedProductsFedaratedInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgDiscontinuedProductsFedaratedInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgDiscontinuedProductsFedaratedUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgDiscontinuedProductsFedaratedUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgDiscontinuedProductsFedaratedDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgDiscontinuedProductsFedaratedDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgDiscontinuedProductsFedaratedSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgDiscontinuedProductsFedaratedSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgDiscontinuedProductsFedaratedSelect
(
@ProductID	INT = NULL
)
AS

IF @ProductID IS NULL BEGIN
	SELECT	[ProductID], [ProductName]
	FROM [DiscontinuedProductsFedarated]
END ELSE BEGIN
	SELECT	[ProductID], [ProductName]
	FROM [DiscontinuedProductsFedarated]
	WHERE 
	[ProductID] = @ProductID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgDiscontinuedProductsFedaratedInsert
(
@ProductID	INT,
@ProductName	NVARCHAR(40))
AS
INSERT [DiscontinuedProductsFedarated]
	([ProductName])
VALUES
(@ProductName)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgDiscontinuedProductsFedaratedUpdate
(
@ProductID	INT, 
@ProductName	NVARCHAR(40)
)
AS
UPDATE [DiscontinuedProductsFedarated]
SET	[ProductName] = @ProductName
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgDiscontinuedProductsFedaratedDelete
(
@ProductID	INT
)
AS
DELETE FROM [DiscontinuedProductsFedarated]
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeSelect
(
@EmployeeID	INT = NULL
)
AS

IF @EmployeeID IS NULL BEGIN
	SELECT	[EmployeeID], [Address], [BirthDate], [City], [Country], [Extension],
			[FirstName], [HireDate], [HomePhone], [LastName],
			[Notes], [Photo], [PhotoPath], [PostalCode], [Region],
			[ReportsTo], [Title], [TitleOfCourtesy]
	FROM [Employees]
END ELSE BEGIN
	SELECT	[EmployeeID], [Address], [BirthDate], [City], [Country], [Extension],
			[FirstName], [HireDate], [HomePhone], [LastName],
			[Notes], [Photo], [PhotoPath], [PostalCode], [Region],
			[ReportsTo], [Title], [TitleOfCourtesy]
	FROM [Employees]
	WHERE 
	[EmployeeID] = @EmployeeID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeInsert
(
@Address	NVARCHAR(60) = null,
@BirthDate	DATETIME = null,
@City	NVARCHAR(15) = null,
@Country	NVARCHAR(15) = null,
@Extension	NVARCHAR(4) = null,
@FirstName	NVARCHAR(10),
@HireDate	DATETIME = null,
@HomePhone	NVARCHAR(24) = null,
@LastName	NVARCHAR(20),
@Notes	NTEXT = null,
@Photo	IMAGE = null,
@PhotoPath	NVARCHAR(255) = null,
@PostalCode	NVARCHAR(10) = null,
@Region	NVARCHAR(15) = null,
@ReportsTo	INT = null,
@Title	NVARCHAR(30) = null,
@TitleOfCourtesy	NVARCHAR(25) = null)
AS
INSERT [Employees]
	([Address], [BirthDate], [City], [Country], [Extension], [FirstName], [HireDate], [HomePhone], [LastName], [Notes], [Photo], [PhotoPath], [PostalCode], [Region], [ReportsTo], [Title], [TitleOfCourtesy])
VALUES
(@Address, @BirthDate, @City, @Country, @Extension, @FirstName, @HireDate, @HomePhone, @LastName, @Notes, @Photo, @PhotoPath, @PostalCode, @Region, @ReportsTo, @Title, @TitleOfCourtesy)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeUpdate
(
@EmployeeID	INT, 
@Address	NVARCHAR(60) = null, 
@BirthDate	DATETIME = null, 
@City	NVARCHAR(15) = null, 
@Country	NVARCHAR(15) = null, 
@Extension	NVARCHAR(4) = null, 
@FirstName	NVARCHAR(10), 
@HireDate	DATETIME = null, 
@HomePhone	NVARCHAR(24) = null, 
@LastName	NVARCHAR(20), 
@Notes	NTEXT = null, 
@Photo	IMAGE = null, 
@PhotoPath	NVARCHAR(255) = null, 
@PostalCode	NVARCHAR(10) = null, 
@Region	NVARCHAR(15) = null, 
@ReportsTo	INT = null, 
@Title	NVARCHAR(30) = null, 
@TitleOfCourtesy	NVARCHAR(25) = null
)
AS
UPDATE [Employees]
SET	[Address] = @Address, 
	[BirthDate] = @BirthDate, 
	[City] = @City, 
	[Country] = @Country, 
	[Extension] = @Extension, 
	[FirstName] = @FirstName, 
	[HireDate] = @HireDate, 
	[HomePhone] = @HomePhone, 
	[LastName] = @LastName, 
	[Notes] = @Notes, 
	[Photo] = @Photo, 
	[PhotoPath] = @PhotoPath, 
	[PostalCode] = @PostalCode, 
	[Region] = @Region, 
	[ReportsTo] = @ReportsTo, 
	[Title] = @Title, 
	[TitleOfCourtesy] = @TitleOfCourtesy
WHERE 
[EmployeeID] = @EmployeeID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeDelete
(
@EmployeeID	INT
)
AS
DELETE FROM [Employees]
WHERE 
[EmployeeID] = @EmployeeID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeSplitSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeSplitSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeSplitInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeSplitInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeSplitUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeSplitUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeSplitDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeSplitDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeSplitSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeSplitSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeSplitSelect
(
@ID	INT = NULL
)
AS

IF @ID IS NULL BEGIN
	SELECT	[ID], [Extension], [PhotoPath]
	FROM [EmployeeSplit]
END ELSE BEGIN
	SELECT	[ID], [Extension], [PhotoPath]
	FROM [EmployeeSplit]
	WHERE 
	[ID] = @ID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeSplitInsert
(
@ID	INT,
@Extension	NVARCHAR(4) = null,
@PhotoPath	NVARCHAR(255) = null)
AS
INSERT [EmployeeSplit]
	([Extension], [PhotoPath])
VALUES
(@Extension, @PhotoPath)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeSplitUpdate
(
@ID	INT, 
@Extension	NVARCHAR(4) = null, 
@PhotoPath	NVARCHAR(255) = null
)
AS
UPDATE [EmployeeSplit]
SET	[Extension] = @Extension, 
	[PhotoPath] = @PhotoPath
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeSplitDelete
(
@ID	INT
)
AS
DELETE FROM [EmployeeSplit]
WHERE 
[ID] = @ID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeTerritoriesSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeTerritoriesSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeTerritoriesInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeTerritoriesInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeTerritoriesUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeTerritoriesUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeTerritoriesDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeTerritoriesDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgEmployeeTerritoriesSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgEmployeeTerritoriesSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeTerritoriesSelect
(
@EmployeeTeritoriesID	INT = NULL
)
AS

IF @EmployeeTeritoriesID IS NULL BEGIN
	SELECT	[EmployeeTeritoriesID], [EmployeeID], [TerritoryID]
	FROM [EmployeeTerritories]
END ELSE BEGIN
	SELECT	[EmployeeTeritoriesID], [EmployeeID], [TerritoryID]
	FROM [EmployeeTerritories]
	WHERE 
	[EmployeeTeritoriesID] = @EmployeeTeritoriesID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeTerritoriesInsert
(
@EmployeeID	INT,
@TerritoryID	NVARCHAR(20))
AS
INSERT [EmployeeTerritories]
	([EmployeeID], [TerritoryID])
VALUES
(@EmployeeID, @TerritoryID)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeTerritoriesUpdate
(
@EmployeeTeritoriesID	INT, 
@EmployeeID	INT, 
@TerritoryID	NVARCHAR(20)
)
AS
UPDATE [EmployeeTerritories]
SET	[EmployeeID] = @EmployeeID, 
	[TerritoryID] = @TerritoryID
WHERE 
[EmployeeTeritoriesID] = @EmployeeTeritoriesID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgEmployeeTerritoriesDelete
(
@EmployeeTeritoriesID	INT
)
AS
DELETE FROM [EmployeeTerritories]
WHERE 
[EmployeeTeritoriesID] = @EmployeeTeritoriesID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrderDetailsSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrderDetailsSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrderDetailsInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrderDetailsInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrderDetailsUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrderDetailsUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrderDetailsDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrderDetailsDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrderDetailsSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrderDetailsSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrderDetailsSelect
(
@OrderID	INT = NULL
)
AS

IF @OrderID IS NULL BEGIN
	SELECT	[OrderID], [Discount], [Quantity], [UnitPrice]
	FROM [OrderDetails]
END ELSE BEGIN
	SELECT	[OrderID], [Discount], [Quantity], [UnitPrice]
	FROM [OrderDetails]
	WHERE 
	[OrderID] = @OrderID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrderDetailsInsert
(
@OrderID	INT,
@Discount	REAL,
@Quantity	SMALLINT,
@UnitPrice	MONEY)
AS
INSERT [OrderDetails]
	([Discount], [Quantity], [UnitPrice])
VALUES
(@Discount, @Quantity, @UnitPrice)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrderDetailsUpdate
(
@OrderID	INT, 
@Discount	REAL, 
@Quantity	SMALLINT, 
@UnitPrice	MONEY
)
AS
UPDATE [OrderDetails]
SET	[Discount] = @Discount, 
	[Quantity] = @Quantity, 
	[UnitPrice] = @UnitPrice
WHERE 
[OrderID] = @OrderID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrderDetailsDelete
(
@OrderID	INT
)
AS
DELETE FROM [OrderDetails]
WHERE 
[OrderID] = @OrderID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrdersSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrdersSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrdersInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrdersInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrdersUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrdersUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrdersDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrdersDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgOrdersSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgOrdersSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrdersSelect
(
@OrderID	INT = NULL
)
AS

IF @OrderID IS NULL BEGIN
	SELECT	[OrderID], [CustomerID], [EmployeeID], [Freight], [OrderDate],
			[RequiredDate], [ShipAddress], [ShipCity], [ShipCountry],
			[ShipName], [ShippedDate], [ShipPostalCode], [ShipRegion],
			[ShipVia]
	FROM [Orders]
END ELSE BEGIN
	SELECT	[OrderID], [CustomerID], [EmployeeID], [Freight], [OrderDate],
			[RequiredDate], [ShipAddress], [ShipCity], [ShipCountry],
			[ShipName], [ShippedDate], [ShipPostalCode], [ShipRegion],
			[ShipVia]
	FROM [Orders]
	WHERE 
	[OrderID] = @OrderID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrdersInsert
(
@CustomerID	NCHAR(5) = null,
@EmployeeID	INT = null,
@Freight	MONEY = null,
@OrderDate	DATETIME = null,
@RequiredDate	DATETIME = null,
@ShipAddress	NVARCHAR(60) = null,
@ShipCity	NVARCHAR(15) = null,
@ShipCountry	NVARCHAR(15) = null,
@ShipName	NVARCHAR(40) = null,
@ShippedDate	DATETIME = null,
@ShipPostalCode	NVARCHAR(10) = null,
@ShipRegion	NVARCHAR(15) = null,
@ShipVia	INT = null)
AS
INSERT [Orders]
	([CustomerID], [EmployeeID], [Freight], [OrderDate], [RequiredDate], [ShipAddress], [ShipCity], [ShipCountry], [ShipName], [ShippedDate], [ShipPostalCode], [ShipRegion], [ShipVia])
VALUES
(@CustomerID, @EmployeeID, @Freight, @OrderDate, @RequiredDate, @ShipAddress, @ShipCity, @ShipCountry, @ShipName, @ShippedDate, @ShipPostalCode, @ShipRegion, @ShipVia)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrdersUpdate
(
@OrderID	INT, 
@CustomerID	NCHAR(5) = null, 
@EmployeeID	INT = null, 
@Freight	MONEY = null, 
@OrderDate	DATETIME = null, 
@RequiredDate	DATETIME = null, 
@ShipAddress	NVARCHAR(60) = null, 
@ShipCity	NVARCHAR(15) = null, 
@ShipCountry	NVARCHAR(15) = null, 
@ShipName	NVARCHAR(40) = null, 
@ShippedDate	DATETIME = null, 
@ShipPostalCode	NVARCHAR(10) = null, 
@ShipRegion	NVARCHAR(15) = null, 
@ShipVia	INT = null
)
AS
UPDATE [Orders]
SET	[CustomerID] = @CustomerID, 
	[EmployeeID] = @EmployeeID, 
	[Freight] = @Freight, 
	[OrderDate] = @OrderDate, 
	[RequiredDate] = @RequiredDate, 
	[ShipAddress] = @ShipAddress, 
	[ShipCity] = @ShipCity, 
	[ShipCountry] = @ShipCountry, 
	[ShipName] = @ShipName, 
	[ShippedDate] = @ShippedDate, 
	[ShipPostalCode] = @ShipPostalCode, 
	[ShipRegion] = @ShipRegion, 
	[ShipVia] = @ShipVia
WHERE 
[OrderID] = @OrderID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgOrdersDelete
(
@OrderID	INT
)
AS
DELETE FROM [Orders]
WHERE 
[OrderID] = @OrderID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgProductsSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgProductsSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgProductsInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgProductsInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgProductsUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgProductsUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgProductsDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgProductsDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgProductsSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgProductsSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgProductsSelect
(
@ProductID	INT = NULL
)
AS

IF @ProductID IS NULL BEGIN
	SELECT	[ProductID], [CategoryID], [Discontinued], [ProductName], [QuantityPerUnit],
			[ReorderLevel], [SupplierID], [UnitPrice], [UnitsInStock],
			[UnitsOnOrder]
	FROM [Products]
END ELSE BEGIN
	SELECT	[ProductID], [CategoryID], [Discontinued], [ProductName], [QuantityPerUnit],
			[ReorderLevel], [SupplierID], [UnitPrice], [UnitsInStock],
			[UnitsOnOrder]
	FROM [Products]
	WHERE 
	[ProductID] = @ProductID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgProductsInsert
(
@CategoryID	INT = null,
@Discontinued	BIT,
@ProductName	NVARCHAR(40),
@QuantityPerUnit	NVARCHAR(20) = null,
@ReorderLevel	SMALLINT = null,
@SupplierID	INT = null,
@UnitPrice	MONEY = null,
@UnitsInStock	SMALLINT = null,
@UnitsOnOrder	SMALLINT = null)
AS
INSERT [Products]
	([CategoryID], [Discontinued], [ProductName], [QuantityPerUnit], [ReorderLevel], [SupplierID], [UnitPrice], [UnitsInStock], [UnitsOnOrder])
VALUES
(@CategoryID, @Discontinued, @ProductName, @QuantityPerUnit, @ReorderLevel, @SupplierID, @UnitPrice, @UnitsInStock, @UnitsOnOrder)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgProductsUpdate
(
@ProductID	INT, 
@CategoryID	INT = null, 
@Discontinued	BIT, 
@ProductName	NVARCHAR(40), 
@QuantityPerUnit	NVARCHAR(20) = null, 
@ReorderLevel	SMALLINT = null, 
@SupplierID	INT = null, 
@UnitPrice	MONEY = null, 
@UnitsInStock	SMALLINT = null, 
@UnitsOnOrder	SMALLINT = null
)
AS
UPDATE [Products]
SET	[CategoryID] = @CategoryID, 
	[Discontinued] = @Discontinued, 
	[ProductName] = @ProductName, 
	[QuantityPerUnit] = @QuantityPerUnit, 
	[ReorderLevel] = @ReorderLevel, 
	[SupplierID] = @SupplierID, 
	[UnitPrice] = @UnitPrice, 
	[UnitsInStock] = @UnitsInStock, 
	[UnitsOnOrder] = @UnitsOnOrder
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgProductsDelete
(
@ProductID	INT
)
AS
DELETE FROM [Products]
WHERE 
[ProductID] = @ProductID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgRegionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgRegionSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgRegionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgRegionInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgRegionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgRegionUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgRegionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgRegionDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgRegionSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgRegionSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgRegionSelect
(
@RegionID	INT = NULL
)
AS

IF @RegionID IS NULL BEGIN
	SELECT	[RegionID], [RegionDescription]
	FROM [Region]
END ELSE BEGIN
	SELECT	[RegionID], [RegionDescription]
	FROM [Region]
	WHERE 
	[RegionID] = @RegionID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgRegionInsert
(
@RegionID	INT,
@RegionDescription	NCHAR(50))
AS
INSERT [Region]
	([RegionDescription])
VALUES
(@RegionDescription)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgRegionUpdate
(
@RegionID	INT, 
@RegionDescription	NCHAR(50)
)
AS
UPDATE [Region]
SET	[RegionDescription] = @RegionDescription
WHERE 
[RegionID] = @RegionID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgRegionDelete
(
@RegionID	INT
)
AS
DELETE FROM [Region]
WHERE 
[RegionID] = @RegionID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgShippersSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgShippersSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgShippersInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgShippersInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgShippersUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgShippersUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgShippersDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgShippersDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgShippersSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgShippersSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgShippersSelect
(
@ShipperID	INT = NULL
)
AS

IF @ShipperID IS NULL BEGIN
	SELECT	[ShipperID], [CompanyName], [Phone]
	FROM [Shippers]
END ELSE BEGIN
	SELECT	[ShipperID], [CompanyName], [Phone]
	FROM [Shippers]
	WHERE 
	[ShipperID] = @ShipperID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgShippersInsert
(
@CompanyName	NVARCHAR(40),
@Phone	NVARCHAR(24) = null)
AS
INSERT [Shippers]
	([CompanyName], [Phone])
VALUES
(@CompanyName, @Phone)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgShippersUpdate
(
@ShipperID	INT, 
@CompanyName	NVARCHAR(40), 
@Phone	NVARCHAR(24) = null
)
AS
UPDATE [Shippers]
SET	[CompanyName] = @CompanyName, 
	[Phone] = @Phone
WHERE 
[ShipperID] = @ShipperID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgShippersDelete
(
@ShipperID	INT
)
AS
DELETE FROM [Shippers]
WHERE 
[ShipperID] = @ShipperID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgSuppliersSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgSuppliersSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgSuppliersInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgSuppliersInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgSuppliersUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgSuppliersUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgSuppliersDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgSuppliersDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgSuppliersSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgSuppliersSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgSuppliersSelect
(
@SupplierID	INT = NULL
)
AS

IF @SupplierID IS NULL BEGIN
	SELECT	[SupplierID], [Address], [City], [CompanyName], [ContactName],
			[ContactTitle], [Country], [Fax], [HomePage], [Phone],
			[PostalCode], [Region]
	FROM [Suppliers]
END ELSE BEGIN
	SELECT	[SupplierID], [Address], [City], [CompanyName], [ContactName],
			[ContactTitle], [Country], [Fax], [HomePage], [Phone],
			[PostalCode], [Region]
	FROM [Suppliers]
	WHERE 
	[SupplierID] = @SupplierID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgSuppliersInsert
(
@Address	NVARCHAR(60) = null,
@City	NVARCHAR(15) = null,
@CompanyName	NVARCHAR(40),
@ContactName	NVARCHAR(30) = null,
@ContactTitle	NVARCHAR(30) = null,
@Country	NVARCHAR(15) = null,
@Fax	NVARCHAR(24) = null,
@HomePage	NTEXT = null,
@Phone	NVARCHAR(24) = null,
@PostalCode	NVARCHAR(10) = null,
@Region	NVARCHAR(15) = null)
AS
INSERT [Suppliers]
	([Address], [City], [CompanyName], [ContactName], [ContactTitle], [Country], [Fax], [HomePage], [Phone], [PostalCode], [Region])
VALUES
(@Address, @City, @CompanyName, @ContactName, @ContactTitle, @Country, @Fax, @HomePage, @Phone, @PostalCode, @Region)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgSuppliersUpdate
(
@SupplierID	INT, 
@Address	NVARCHAR(60) = null, 
@City	NVARCHAR(15) = null, 
@CompanyName	NVARCHAR(40), 
@ContactName	NVARCHAR(30) = null, 
@ContactTitle	NVARCHAR(30) = null, 
@Country	NVARCHAR(15) = null, 
@Fax	NVARCHAR(24) = null, 
@HomePage	NTEXT = null, 
@Phone	NVARCHAR(24) = null, 
@PostalCode	NVARCHAR(10) = null, 
@Region	NVARCHAR(15) = null
)
AS
UPDATE [Suppliers]
SET	[Address] = @Address, 
	[City] = @City, 
	[CompanyName] = @CompanyName, 
	[ContactName] = @ContactName, 
	[ContactTitle] = @ContactTitle, 
	[Country] = @Country, 
	[Fax] = @Fax, 
	[HomePage] = @HomePage, 
	[Phone] = @Phone, 
	[PostalCode] = @PostalCode, 
	[Region] = @Region
WHERE 
[SupplierID] = @SupplierID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgSuppliersDelete
(
@SupplierID	INT
)
AS
DELETE FROM [Suppliers]
WHERE 
[SupplierID] = @SupplierID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgTerritoriesSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgTerritoriesSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgTerritoriesInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgTerritoriesInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgTerritoriesUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgTerritoriesUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgTerritoriesDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgTerritoriesDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgTerritoriesSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spgTerritoriesSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgTerritoriesSelect
(
@TerritoryID	NVARCHAR(20) = NULL
)
AS

IF @TerritoryID IS NULL BEGIN
	SELECT	[TerritoryID], [RegionID], [TerritoryDescription]
	FROM [Territories]
END ELSE BEGIN
	SELECT	[TerritoryID], [RegionID], [TerritoryDescription]
	FROM [Territories]
	WHERE 
	[TerritoryID] = @TerritoryID
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgTerritoriesInsert
(
@TerritoryID	NVARCHAR(20),
@RegionID	INT,
@TerritoryDescription	NCHAR(50))
AS
INSERT [Territories]
	([RegionID], [TerritoryDescription])
VALUES
(@RegionID, @TerritoryDescription)

SELECT SCOPE_IDENTITY()
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgTerritoriesUpdate
(
@TerritoryID	NVARCHAR(20), 
@RegionID	INT, 
@TerritoryDescription	NCHAR(50)
)
AS
UPDATE [Territories]
SET	[RegionID] = @RegionID, 
	[TerritoryDescription] = @TerritoryDescription
WHERE 
[TerritoryID] = @TerritoryID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [dbo].spgTerritoriesDelete
(
@TerritoryID	NVARCHAR(20)
)
AS
DELETE FROM [Territories]
WHERE 
[TerritoryID] = @TerritoryID
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormSelect
(
@ComposableFormGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ComposableFormGuid IS NULL BEGIN
	SELECT	[ComposableFormGuid], [Category], [CreatedBy], [CreatedOn], [Description],
			[EditedBy], [EditedOn], [IsCollapsable], [ISOCode],
			[LayoutMode], [Name], [RequiredDataContextTypeName],
			[SyncTime]
	FROM [ComposableForm]
END ELSE BEGIN
	SELECT	[ComposableFormGuid], [Category], [CreatedBy], [CreatedOn], [Description],
			[EditedBy], [EditedOn], [IsCollapsable], [ISOCode],
			[LayoutMode], [Name], [RequiredDataContextTypeName],
			[SyncTime]
	FROM [ComposableForm]
	WHERE 
	[ComposableFormGuid] = @ComposableFormGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormInsert
(
@ComposableFormGuid	UNIQUEIDENTIFIER,
@Category	NVARCHAR(150) = null,
@CreatedBy	UNIQUEIDENTIFIER,
@CreatedOn	DATETIME,
@Description	NVARCHAR(255) = null,
@EditedBy	UNIQUEIDENTIFIER = null,
@EditedOn	DATETIME = null,
@IsCollapsable	BIT,
@ISOCode	VARCHAR(20) = null,
@LayoutMode	INT,
@Name	NVARCHAR(250),
@RequiredDataContextTypeName	VARCHAR(500) = null,
@SyncTime	DATETIME = null)
AS
INSERT [ComposableForm]
	([ComposableFormGuid], [Category], [CreatedBy], [CreatedOn], [Description], [EditedBy], [EditedOn], [IsCollapsable], [ISOCode], [LayoutMode], [Name], [RequiredDataContextTypeName], [SyncTime])
VALUES
(@ComposableFormGuid, @Category, @CreatedBy, @CreatedOn, @Description, @EditedBy, @EditedOn, @IsCollapsable, @ISOCode, @LayoutMode, @Name, @RequiredDataContextTypeName, @SyncTime)

SELECT @ComposableFormGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormUpdate
(
@ComposableFormGuid	UNIQUEIDENTIFIER, 
@Category	NVARCHAR(150) = null, 
@CreatedBy	UNIQUEIDENTIFIER, 
@CreatedOn	DATETIME, 
@Description	NVARCHAR(255) = null, 
@EditedBy	UNIQUEIDENTIFIER = null, 
@EditedOn	DATETIME = null, 
@IsCollapsable	BIT, 
@ISOCode	VARCHAR(20) = null, 
@LayoutMode	INT, 
@Name	NVARCHAR(250), 
@RequiredDataContextTypeName	VARCHAR(500) = null, 
@SyncTime	DATETIME = null
)
AS
UPDATE [ComposableForm]
SET	[Category] = @Category, 
	[CreatedBy] = @CreatedBy, 
	[CreatedOn] = @CreatedOn, 
	[Description] = @Description, 
	[EditedBy] = @EditedBy, 
	[EditedOn] = @EditedOn, 
	[IsCollapsable] = @IsCollapsable, 
	[ISOCode] = @ISOCode, 
	[LayoutMode] = @LayoutMode, 
	[Name] = @Name, 
	[RequiredDataContextTypeName] = @RequiredDataContextTypeName, 
	[SyncTime] = @SyncTime
WHERE 
[ComposableFormGuid] = @ComposableFormGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormDelete
(
@ComposableFormGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [ComposableForm]
WHERE 
[ComposableFormGuid] = @ComposableFormGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormFieldSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormFieldSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormFieldInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormFieldInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormFieldUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormFieldUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormFieldDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormFieldDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormFieldSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormFieldSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormFieldSelect
(
@ComposableFormFieldGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ComposableFormFieldGuid IS NULL BEGIN
	SELECT	[ComposableFormFieldGuid], [BindingPath], [ComposableFormGuid], [ControlParameter],
			[ControlTypeGuid], [CreatedBy], [CreatedOn], [DefaultValue],
			[EditedBy], [EditedOn], [GridColumn], [GridColumnSpan],
			[GridRow], [GridRowSpan], [Height], [IsReadOnly],
			[IsRequired], [IsVisible], [LabelKey], [Name], [OptionBindingPath],
			[OptionDisplayMember], [OptionValueMember], [Style],
			[SyncTime], [ValidationExpression], [VisibilityBindingPath],
			[Width]
	FROM [ComposableFormField]
END ELSE BEGIN
	SELECT	[ComposableFormFieldGuid], [BindingPath], [ComposableFormGuid], [ControlParameter],
			[ControlTypeGuid], [CreatedBy], [CreatedOn], [DefaultValue],
			[EditedBy], [EditedOn], [GridColumn], [GridColumnSpan],
			[GridRow], [GridRowSpan], [Height], [IsReadOnly],
			[IsRequired], [IsVisible], [LabelKey], [Name], [OptionBindingPath],
			[OptionDisplayMember], [OptionValueMember], [Style],
			[SyncTime], [ValidationExpression], [VisibilityBindingPath],
			[Width]
	FROM [ComposableFormField]
	WHERE 
	[ComposableFormFieldGuid] = @ComposableFormFieldGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormFieldInsert
(
@ComposableFormFieldGuid	UNIQUEIDENTIFIER,
@BindingPath	VARCHAR(500) = null,
@ComposableFormGuid	UNIQUEIDENTIFIER,
@ControlParameter	VARCHAR(MAX) = null,
@ControlTypeGuid	UNIQUEIDENTIFIER,
@CreatedBy	UNIQUEIDENTIFIER,
@CreatedOn	DATETIME,
@DefaultValue	NVARCHAR(500) = null,
@EditedBy	UNIQUEIDENTIFIER = null,
@EditedOn	DATETIME = null,
@GridColumn	INT,
@GridColumnSpan	INT,
@GridRow	INT,
@GridRowSpan	INT,
@Height	INT,
@IsReadOnly	BIT,
@IsRequired	BIT,
@IsVisible	BIT,
@LabelKey	NVARCHAR(100) = null,
@Name	VARCHAR(50) = null,
@OptionBindingPath	VARCHAR(128) = null,
@OptionDisplayMember	VARCHAR(128) = null,
@OptionValueMember	VARCHAR(128) = null,
@Style	VARCHAR(250) = null,
@SyncTime	DATETIME = null,
@ValidationExpression	VARCHAR(1024) = null,
@VisibilityBindingPath	VARCHAR(255) = null,
@Width	INT)
AS
INSERT [ComposableFormField]
	([ComposableFormFieldGuid], [BindingPath], [ComposableFormGuid], [ControlParameter], [ControlTypeGuid], [CreatedBy], [CreatedOn], [DefaultValue], [EditedBy], [EditedOn], [GridColumn], [GridColumnSpan], [GridRow], [GridRowSpan], [Height], [IsReadOnly], [IsRequired], [IsVisible], [LabelKey], [Name], [OptionBindingPath], [OptionDisplayMember], [OptionValueMember], [Style], [SyncTime], [ValidationExpression], [VisibilityBindingPath], [Width])
VALUES
(@ComposableFormFieldGuid, @BindingPath, @ComposableFormGuid, @ControlParameter, @ControlTypeGuid, @CreatedBy, @CreatedOn, @DefaultValue, @EditedBy, @EditedOn, @GridColumn, @GridColumnSpan, @GridRow, @GridRowSpan, @Height, @IsReadOnly, @IsRequired, @IsVisible, @LabelKey, @Name, @OptionBindingPath, @OptionDisplayMember, @OptionValueMember, @Style, @SyncTime, @ValidationExpression, @VisibilityBindingPath, @Width)

SELECT @ComposableFormFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormFieldUpdate
(
@ComposableFormFieldGuid	UNIQUEIDENTIFIER, 
@BindingPath	VARCHAR(500) = null, 
@ComposableFormGuid	UNIQUEIDENTIFIER, 
@ControlParameter	VARCHAR(MAX) = null, 
@ControlTypeGuid	UNIQUEIDENTIFIER, 
@CreatedBy	UNIQUEIDENTIFIER, 
@CreatedOn	DATETIME, 
@DefaultValue	NVARCHAR(500) = null, 
@EditedBy	UNIQUEIDENTIFIER = null, 
@EditedOn	DATETIME = null, 
@GridColumn	INT, 
@GridColumnSpan	INT, 
@GridRow	INT, 
@GridRowSpan	INT, 
@Height	INT, 
@IsReadOnly	BIT, 
@IsRequired	BIT, 
@IsVisible	BIT, 
@LabelKey	NVARCHAR(100) = null, 
@Name	VARCHAR(50) = null, 
@OptionBindingPath	VARCHAR(128) = null, 
@OptionDisplayMember	VARCHAR(128) = null, 
@OptionValueMember	VARCHAR(128) = null, 
@Style	VARCHAR(250) = null, 
@SyncTime	DATETIME = null, 
@ValidationExpression	VARCHAR(1024) = null, 
@VisibilityBindingPath	VARCHAR(255) = null, 
@Width	INT
)
AS
UPDATE [ComposableFormField]
SET	[BindingPath] = @BindingPath, 
	[ComposableFormGuid] = @ComposableFormGuid, 
	[ControlParameter] = @ControlParameter, 
	[ControlTypeGuid] = @ControlTypeGuid, 
	[CreatedBy] = @CreatedBy, 
	[CreatedOn] = @CreatedOn, 
	[DefaultValue] = @DefaultValue, 
	[EditedBy] = @EditedBy, 
	[EditedOn] = @EditedOn, 
	[GridColumn] = @GridColumn, 
	[GridColumnSpan] = @GridColumnSpan, 
	[GridRow] = @GridRow, 
	[GridRowSpan] = @GridRowSpan, 
	[Height] = @Height, 
	[IsReadOnly] = @IsReadOnly, 
	[IsRequired] = @IsRequired, 
	[IsVisible] = @IsVisible, 
	[LabelKey] = @LabelKey, 
	[Name] = @Name, 
	[OptionBindingPath] = @OptionBindingPath, 
	[OptionDisplayMember] = @OptionDisplayMember, 
	[OptionValueMember] = @OptionValueMember, 
	[Style] = @Style, 
	[SyncTime] = @SyncTime, 
	[ValidationExpression] = @ValidationExpression, 
	[VisibilityBindingPath] = @VisibilityBindingPath, 
	[Width] = @Width
WHERE 
[ComposableFormFieldGuid] = @ComposableFormFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormFieldDelete
(
@ComposableFormFieldGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [ComposableFormField]
WHERE 
[ComposableFormFieldGuid] = @ComposableFormFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageSelect
(
@ComposableFormPageGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ComposableFormPageGuid IS NULL BEGIN
	SELECT	[ComposableFormPageGuid], [ComposableFormGuid], [ComposableFormPageSetGuid],
			[DisplayCondition], [Order], [Title]
	FROM [ComposableFormPage]
END ELSE BEGIN
	SELECT	[ComposableFormPageGuid], [ComposableFormGuid], [ComposableFormPageSetGuid],
			[DisplayCondition], [Order], [Title]
	FROM [ComposableFormPage]
	WHERE 
	[ComposableFormPageGuid] = @ComposableFormPageGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageInsert
(
@ComposableFormPageGuid	UNIQUEIDENTIFIER,
@ComposableFormGuid	UNIQUEIDENTIFIER,
@ComposableFormPageSetGuid	UNIQUEIDENTIFIER,
@DisplayCondition	VARCHAR(500) = null,
@Order	INT,
@Title	NCHAR(10))
AS
INSERT [ComposableFormPage]
	([ComposableFormPageGuid], [ComposableFormGuid], [ComposableFormPageSetGuid], [DisplayCondition], [Order], [Title])
VALUES
(@ComposableFormPageGuid, @ComposableFormGuid, @ComposableFormPageSetGuid, @DisplayCondition, @Order, @Title)

SELECT @ComposableFormPageGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageUpdate
(
@ComposableFormPageGuid	UNIQUEIDENTIFIER, 
@ComposableFormGuid	UNIQUEIDENTIFIER, 
@ComposableFormPageSetGuid	UNIQUEIDENTIFIER, 
@DisplayCondition	VARCHAR(500) = null, 
@Order	INT, 
@Title	NCHAR(10)
)
AS
UPDATE [ComposableFormPage]
SET	[ComposableFormGuid] = @ComposableFormGuid, 
	[ComposableFormPageSetGuid] = @ComposableFormPageSetGuid, 
	[DisplayCondition] = @DisplayCondition, 
	[Order] = @Order, 
	[Title] = @Title
WHERE 
[ComposableFormPageGuid] = @ComposableFormPageGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageDelete
(
@ComposableFormPageGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [ComposableFormPage]
WHERE 
[ComposableFormPageGuid] = @ComposableFormPageGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageSetSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageSetSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageSetInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageSetInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageSetUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageSetUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageSetDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageSetDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgComposableFormPageSetSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgComposableFormPageSetSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageSetSelect
(
@ComposableFormPageSetGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ComposableFormPageSetGuid IS NULL BEGIN
	SELECT	[ComposableFormPageSetGuid], [Description], [Name]
	FROM [ComposableFormPageSet]
END ELSE BEGIN
	SELECT	[ComposableFormPageSetGuid], [Description], [Name]
	FROM [ComposableFormPageSet]
	WHERE 
	[ComposableFormPageSetGuid] = @ComposableFormPageSetGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageSetInsert
(
@ComposableFormPageSetGuid	UNIQUEIDENTIFIER,
@Description	NVARCHAR(250) = null,
@Name	NVARCHAR(50))
AS
INSERT [ComposableFormPageSet]
	([ComposableFormPageSetGuid], [Description], [Name])
VALUES
(@ComposableFormPageSetGuid, @Description, @Name)

SELECT @ComposableFormPageSetGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageSetUpdate
(
@ComposableFormPageSetGuid	UNIQUEIDENTIFIER, 
@Description	NVARCHAR(250) = null, 
@Name	NVARCHAR(50)
)
AS
UPDATE [ComposableFormPageSet]
SET	[Description] = @Description, 
	[Name] = @Name
WHERE 
[ComposableFormPageSetGuid] = @ComposableFormPageSetGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgComposableFormPageSetDelete
(
@ComposableFormPageSetGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [ComposableFormPageSet]
WHERE 
[ComposableFormPageSetGuid] = @ComposableFormPageSetGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgConjunctionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgConjunctionSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgConjunctionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgConjunctionInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgConjunctionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgConjunctionUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgConjunctionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgConjunctionDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgConjunctionSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgConjunctionSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgConjunctionSelect
(
@ConjunctionGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ConjunctionGuid IS NULL BEGIN
	SELECT	[ConjunctionGuid], [Description], [Name]
	FROM [Conjunction]
END ELSE BEGIN
	SELECT	[ConjunctionGuid], [Description], [Name]
	FROM [Conjunction]
	WHERE 
	[ConjunctionGuid] = @ConjunctionGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgConjunctionInsert
(
@ConjunctionGuid	UNIQUEIDENTIFIER,
@Description	NVARCHAR(50),
@Name	NVARCHAR(50))
AS
INSERT [Conjunction]
	([ConjunctionGuid], [Description], [Name])
VALUES
(@ConjunctionGuid, @Description, @Name)

SELECT @ConjunctionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgConjunctionUpdate
(
@ConjunctionGuid	UNIQUEIDENTIFIER, 
@Description	NVARCHAR(50), 
@Name	NVARCHAR(50)
)
AS
UPDATE [Conjunction]
SET	[Description] = @Description, 
	[Name] = @Name
WHERE 
[ConjunctionGuid] = @ConjunctionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgConjunctionDelete
(
@ConjunctionGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [Conjunction]
WHERE 
[ConjunctionGuid] = @ConjunctionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgControlTypeSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgControlTypeSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgControlTypeInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgControlTypeInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgControlTypeUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgControlTypeUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgControlTypeDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgControlTypeDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgControlTypeSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgControlTypeSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgControlTypeSelect
(
@ControlTypeGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ControlTypeGuid IS NULL BEGIN
	SELECT	[ControlTypeGuid], [Name^Key] AS [Name]
	FROM [ControlType^Enum]
END ELSE BEGIN
	SELECT	[ControlTypeGuid], [Name^Key] AS [Name]
	FROM [ControlType^Enum]
	WHERE 
	[ControlTypeGuid] = @ControlTypeGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgControlTypeInsert
(
@ControlTypeGuid	UNIQUEIDENTIFIER,
@Name	NVARCHAR(50))
AS
INSERT [ControlType^Enum]
	([ControlTypeGuid], [Name^Key])
VALUES
(@ControlTypeGuid, @Name)

SELECT @ControlTypeGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgControlTypeUpdate
(
@ControlTypeGuid	UNIQUEIDENTIFIER, 
@Name	NVARCHAR(50)
)
AS
UPDATE [ControlType^Enum]
SET	[Name^Key] = @Name
WHERE 
[ControlTypeGuid] = @ControlTypeGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgControlTypeDelete
(
@ControlTypeGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [ControlType^Enum]
WHERE 
[ControlTypeGuid] = @ControlTypeGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldSelect
(
@ExtensionFieldGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ExtensionFieldGuid IS NULL BEGIN
	SELECT	[ExtensionFieldGuid], [ControlTypeGuid], [DataTypeGuid], [Key], [OwnerGuid],
			[Sequence], [Value]
	FROM [ExtensionField]
END ELSE BEGIN
	SELECT	[ExtensionFieldGuid], [ControlTypeGuid], [DataTypeGuid], [Key], [OwnerGuid],
			[Sequence], [Value]
	FROM [ExtensionField]
	WHERE 
	[ExtensionFieldGuid] = @ExtensionFieldGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldInsert
(
@ExtensionFieldGuid	UNIQUEIDENTIFIER,
@ControlTypeGuid	UNIQUEIDENTIFIER = null,
@DataTypeGuid	UNIQUEIDENTIFIER = null,
@Key	NVARCHAR(50),
@OwnerGuid	UNIQUEIDENTIFIER,
@Sequence	INT,
@Value	NVARCHAR(1024) = null)
AS
INSERT [ExtensionField]
	([ExtensionFieldGuid], [ControlTypeGuid], [DataTypeGuid], [Key], [OwnerGuid], [Sequence], [Value])
VALUES
(@ExtensionFieldGuid, @ControlTypeGuid, @DataTypeGuid, @Key, @OwnerGuid, @Sequence, @Value)

SELECT @ExtensionFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldUpdate
(
@ExtensionFieldGuid	UNIQUEIDENTIFIER, 
@ControlTypeGuid	UNIQUEIDENTIFIER = null, 
@DataTypeGuid	UNIQUEIDENTIFIER = null, 
@Key	NVARCHAR(50), 
@OwnerGuid	UNIQUEIDENTIFIER, 
@Sequence	INT, 
@Value	NVARCHAR(1024) = null
)
AS
UPDATE [ExtensionField]
SET	[ControlTypeGuid] = @ControlTypeGuid, 
	[DataTypeGuid] = @DataTypeGuid, 
	[Key] = @Key, 
	[OwnerGuid] = @OwnerGuid, 
	[Sequence] = @Sequence, 
	[Value] = @Value
WHERE 
[ExtensionFieldGuid] = @ExtensionFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldDelete
(
@ExtensionFieldGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [ExtensionField]
WHERE 
[ExtensionFieldGuid] = @ExtensionFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldOptionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldOptionSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldOptionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldOptionInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldOptionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldOptionUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldOptionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldOptionDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgExtensionFieldOptionSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgExtensionFieldOptionSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldOptionSelect
(
@ExtensionFieldOptionGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @ExtensionFieldOptionGuid IS NULL BEGIN
	SELECT	[ExtensionFieldOptionGuid], [Display], [Key], [Sequence], [Value]
	FROM [ExtensionFieldOption]
END ELSE BEGIN
	SELECT	[ExtensionFieldOptionGuid], [Display], [Key], [Sequence], [Value]
	FROM [ExtensionFieldOption]
	WHERE 
	[ExtensionFieldOptionGuid] = @ExtensionFieldOptionGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldOptionInsert
(
@ExtensionFieldOptionGuid	UNIQUEIDENTIFIER,
@Display	NVARCHAR(50),
@Key	NVARCHAR(50),
@Sequence	INT = null,
@Value	NVARCHAR(1024))
AS
INSERT [ExtensionFieldOption]
	([ExtensionFieldOptionGuid], [Display], [Key], [Sequence], [Value])
VALUES
(@ExtensionFieldOptionGuid, @Display, @Key, @Sequence, @Value)

SELECT @ExtensionFieldOptionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldOptionUpdate
(
@ExtensionFieldOptionGuid	UNIQUEIDENTIFIER, 
@Display	NVARCHAR(50), 
@Key	NVARCHAR(50), 
@Sequence	INT = null, 
@Value	NVARCHAR(1024)
)
AS
UPDATE [ExtensionFieldOption]
SET	[Display] = @Display, 
	[Key] = @Key, 
	[Sequence] = @Sequence, 
	[Value] = @Value
WHERE 
[ExtensionFieldOptionGuid] = @ExtensionFieldOptionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgExtensionFieldOptionDelete
(
@ExtensionFieldOptionGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [ExtensionFieldOption]
WHERE 
[ExtensionFieldOptionGuid] = @ExtensionFieldOptionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldSelect
(
@FieldGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @FieldGuid IS NULL BEGIN
	SELECT	[FieldGuid], [ControlTypeGuid], [DataTypeGuid], [Name]
	FROM [Field]
END ELSE BEGIN
	SELECT	[FieldGuid], [ControlTypeGuid], [DataTypeGuid], [Name]
	FROM [Field]
	WHERE 
	[FieldGuid] = @FieldGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldInsert
(
@FieldGuid	UNIQUEIDENTIFIER,
@ControlTypeGuid	UNIQUEIDENTIFIER,
@DataTypeGuid	UNIQUEIDENTIFIER,
@Name	NVARCHAR(50))
AS
INSERT [Field]
	([FieldGuid], [ControlTypeGuid], [DataTypeGuid], [Name])
VALUES
(@FieldGuid, @ControlTypeGuid, @DataTypeGuid, @Name)

SELECT @FieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldUpdate
(
@FieldGuid	UNIQUEIDENTIFIER, 
@ControlTypeGuid	UNIQUEIDENTIFIER, 
@DataTypeGuid	UNIQUEIDENTIFIER, 
@Name	NVARCHAR(50)
)
AS
UPDATE [Field]
SET	[ControlTypeGuid] = @ControlTypeGuid, 
	[DataTypeGuid] = @DataTypeGuid, 
	[Name] = @Name
WHERE 
[FieldGuid] = @FieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldDelete
(
@FieldGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [Field]
WHERE 
[FieldGuid] = @FieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldOptionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldOptionSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldOptionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldOptionInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldOptionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldOptionUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldOptionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldOptionDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFieldOptionSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFieldOptionSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldOptionSelect
(
@FieldOptionGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @FieldOptionGuid IS NULL BEGIN
	SELECT	[FieldOptionGuid], [Display], [FieldGuid], [Value]
	FROM [FieldOption]
END ELSE BEGIN
	SELECT	[FieldOptionGuid], [Display], [FieldGuid], [Value]
	FROM [FieldOption]
	WHERE 
	[FieldOptionGuid] = @FieldOptionGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldOptionInsert
(
@FieldOptionGuid	UNIQUEIDENTIFIER,
@Display	NVARCHAR(50),
@FieldGuid	UNIQUEIDENTIFIER,
@Value	NVARCHAR(500))
AS
INSERT [FieldOption]
	([FieldOptionGuid], [Display], [FieldGuid], [Value])
VALUES
(@FieldOptionGuid, @Display, @FieldGuid, @Value)

SELECT @FieldOptionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldOptionUpdate
(
@FieldOptionGuid	UNIQUEIDENTIFIER, 
@Display	NVARCHAR(50), 
@FieldGuid	UNIQUEIDENTIFIER, 
@Value	NVARCHAR(500)
)
AS
UPDATE [FieldOption]
SET	[Display] = @Display, 
	[FieldGuid] = @FieldGuid, 
	[Value] = @Value
WHERE 
[FieldOptionGuid] = @FieldOptionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFieldOptionDelete
(
@FieldOptionGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [FieldOption]
WHERE 
[FieldOptionGuid] = @FieldOptionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldSelect
(
@FormFieldGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @FormFieldGuid IS NULL BEGIN
	SELECT	[FormFieldGuid], [CreatedBy], [CreatedOn], [DefaultValue], [Description],
			[EditedBy], [EditedOn], [FieldGuid], [FormGuid],
			[FormulaGuid], [GridColumn], [GridColumnSpan],
			[GridRow], [GridRowSpan], [IsRequired], [Name], [SyncTime]
	FROM [FormField]
END ELSE BEGIN
	SELECT	[FormFieldGuid], [CreatedBy], [CreatedOn], [DefaultValue], [Description],
			[EditedBy], [EditedOn], [FieldGuid], [FormGuid],
			[FormulaGuid], [GridColumn], [GridColumnSpan],
			[GridRow], [GridRowSpan], [IsRequired], [Name], [SyncTime]
	FROM [FormField]
	WHERE 
	[FormFieldGuid] = @FormFieldGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldInsert
(
@FormFieldGuid	UNIQUEIDENTIFIER,
@CreatedBy	UNIQUEIDENTIFIER,
@CreatedOn	DATETIME,
@DefaultValue	NVARCHAR(500) = null,
@Description	NVARCHAR(128) = null,
@EditedBy	UNIQUEIDENTIFIER = null,
@EditedOn	DATETIME = null,
@FieldGuid	UNIQUEIDENTIFIER,
@FormGuid	UNIQUEIDENTIFIER,
@FormulaGuid	UNIQUEIDENTIFIER = null,
@GridColumn	INT,
@GridColumnSpan	INT,
@GridRow	INT,
@GridRowSpan	INT,
@IsRequired	BIT,
@Name	NVARCHAR(50),
@SyncTime	DATETIME = null)
AS
INSERT [FormField]
	([FormFieldGuid], [CreatedBy], [CreatedOn], [DefaultValue], [Description], [EditedBy], [EditedOn], [FieldGuid], [FormGuid], [FormulaGuid], [GridColumn], [GridColumnSpan], [GridRow], [GridRowSpan], [IsRequired], [Name], [SyncTime])
VALUES
(@FormFieldGuid, @CreatedBy, @CreatedOn, @DefaultValue, @Description, @EditedBy, @EditedOn, @FieldGuid, @FormGuid, @FormulaGuid, @GridColumn, @GridColumnSpan, @GridRow, @GridRowSpan, @IsRequired, @Name, @SyncTime)

SELECT @FormFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldUpdate
(
@FormFieldGuid	UNIQUEIDENTIFIER, 
@CreatedBy	UNIQUEIDENTIFIER, 
@CreatedOn	DATETIME, 
@DefaultValue	NVARCHAR(500) = null, 
@Description	NVARCHAR(128) = null, 
@EditedBy	UNIQUEIDENTIFIER = null, 
@EditedOn	DATETIME = null, 
@FieldGuid	UNIQUEIDENTIFIER, 
@FormGuid	UNIQUEIDENTIFIER, 
@FormulaGuid	UNIQUEIDENTIFIER = null, 
@GridColumn	INT, 
@GridColumnSpan	INT, 
@GridRow	INT, 
@GridRowSpan	INT, 
@IsRequired	BIT, 
@Name	NVARCHAR(50), 
@SyncTime	DATETIME = null
)
AS
UPDATE [FormField]
SET	[CreatedBy] = @CreatedBy, 
	[CreatedOn] = @CreatedOn, 
	[DefaultValue] = @DefaultValue, 
	[Description] = @Description, 
	[EditedBy] = @EditedBy, 
	[EditedOn] = @EditedOn, 
	[FieldGuid] = @FieldGuid, 
	[FormGuid] = @FormGuid, 
	[FormulaGuid] = @FormulaGuid, 
	[GridColumn] = @GridColumn, 
	[GridColumnSpan] = @GridColumnSpan, 
	[GridRow] = @GridRow, 
	[GridRowSpan] = @GridRowSpan, 
	[IsRequired] = @IsRequired, 
	[Name] = @Name, 
	[SyncTime] = @SyncTime
WHERE 
[FormFieldGuid] = @FormFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldDelete
(
@FormFieldGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [FormField]
WHERE 
[FormFieldGuid] = @FormFieldGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldResponseSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldResponseSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldResponseInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldResponseInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldResponseUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldResponseUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldResponseDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldResponseDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormFieldResponseSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormFieldResponseSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldResponseSelect
(
@FormFieldResponseGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @FormFieldResponseGuid IS NULL BEGIN
	SELECT	[FormFieldResponseGuid], [CreatedBy], [CreatedOn], [EditedBy], [EditedOn],
			[FormFieldGuid], [FormResponseGuid], [SyncTime],
			[Value]
	FROM [FormFieldResponse]
END ELSE BEGIN
	SELECT	[FormFieldResponseGuid], [CreatedBy], [CreatedOn], [EditedBy], [EditedOn],
			[FormFieldGuid], [FormResponseGuid], [SyncTime],
			[Value]
	FROM [FormFieldResponse]
	WHERE 
	[FormFieldResponseGuid] = @FormFieldResponseGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldResponseInsert
(
@FormFieldResponseGuid	UNIQUEIDENTIFIER,
@CreatedBy	UNIQUEIDENTIFIER,
@CreatedOn	DATETIME,
@EditedBy	UNIQUEIDENTIFIER = null,
@EditedOn	DATETIME = null,
@FormFieldGuid	UNIQUEIDENTIFIER,
@FormResponseGuid	UNIQUEIDENTIFIER,
@SyncTime	DATETIME = null,
@Value	NVARCHAR(500))
AS
INSERT [FormFieldResponse]
	([FormFieldResponseGuid], [CreatedBy], [CreatedOn], [EditedBy], [EditedOn], [FormFieldGuid], [FormResponseGuid], [SyncTime], [Value])
VALUES
(@FormFieldResponseGuid, @CreatedBy, @CreatedOn, @EditedBy, @EditedOn, @FormFieldGuid, @FormResponseGuid, @SyncTime, @Value)

SELECT @FormFieldResponseGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldResponseUpdate
(
@FormFieldResponseGuid	UNIQUEIDENTIFIER, 
@CreatedBy	UNIQUEIDENTIFIER, 
@CreatedOn	DATETIME, 
@EditedBy	UNIQUEIDENTIFIER = null, 
@EditedOn	DATETIME = null, 
@FormFieldGuid	UNIQUEIDENTIFIER, 
@FormResponseGuid	UNIQUEIDENTIFIER, 
@SyncTime	DATETIME = null, 
@Value	NVARCHAR(500)
)
AS
UPDATE [FormFieldResponse]
SET	[CreatedBy] = @CreatedBy, 
	[CreatedOn] = @CreatedOn, 
	[EditedBy] = @EditedBy, 
	[EditedOn] = @EditedOn, 
	[FormFieldGuid] = @FormFieldGuid, 
	[FormResponseGuid] = @FormResponseGuid, 
	[SyncTime] = @SyncTime, 
	[Value] = @Value
WHERE 
[FormFieldResponseGuid] = @FormFieldResponseGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormFieldResponseDelete
(
@FormFieldResponseGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [FormFieldResponse]
WHERE 
[FormFieldResponseGuid] = @FormFieldResponseGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormResponseSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormResponseSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormResponseInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormResponseInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormResponseUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormResponseUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormResponseDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormResponseDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormResponseSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormResponseSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormResponseSelect
(
@FormResponseGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @FormResponseGuid IS NULL BEGIN
	SELECT	[FormResponseGuid], [CreatedBy], [CreatedOn], [EditedBy], [EditedOn],
			[FormGuid], [OwnerGuid], [ResponseDate], [SyncTime]
	FROM [FormResponse]
END ELSE BEGIN
	SELECT	[FormResponseGuid], [CreatedBy], [CreatedOn], [EditedBy], [EditedOn],
			[FormGuid], [OwnerGuid], [ResponseDate], [SyncTime]
	FROM [FormResponse]
	WHERE 
	[FormResponseGuid] = @FormResponseGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormResponseInsert
(
@FormResponseGuid	UNIQUEIDENTIFIER,
@CreatedBy	UNIQUEIDENTIFIER,
@CreatedOn	DATETIME,
@EditedBy	UNIQUEIDENTIFIER = null,
@EditedOn	DATETIME = null,
@FormGuid	UNIQUEIDENTIFIER,
@OwnerGuid	UNIQUEIDENTIFIER,
@ResponseDate	DATETIME = null,
@SyncTime	DATETIME = null)
AS
INSERT [FormResponse]
	([FormResponseGuid], [CreatedBy], [CreatedOn], [EditedBy], [EditedOn], [FormGuid], [OwnerGuid], [ResponseDate], [SyncTime])
VALUES
(@FormResponseGuid, @CreatedBy, @CreatedOn, @EditedBy, @EditedOn, @FormGuid, @OwnerGuid, @ResponseDate, @SyncTime)

SELECT @FormResponseGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormResponseUpdate
(
@FormResponseGuid	UNIQUEIDENTIFIER, 
@CreatedBy	UNIQUEIDENTIFIER, 
@CreatedOn	DATETIME, 
@EditedBy	UNIQUEIDENTIFIER = null, 
@EditedOn	DATETIME = null, 
@FormGuid	UNIQUEIDENTIFIER, 
@OwnerGuid	UNIQUEIDENTIFIER, 
@ResponseDate	DATETIME = null, 
@SyncTime	DATETIME = null
)
AS
UPDATE [FormResponse]
SET	[CreatedBy] = @CreatedBy, 
	[CreatedOn] = @CreatedOn, 
	[EditedBy] = @EditedBy, 
	[EditedOn] = @EditedOn, 
	[FormGuid] = @FormGuid, 
	[OwnerGuid] = @OwnerGuid, 
	[ResponseDate] = @ResponseDate, 
	[SyncTime] = @SyncTime
WHERE 
[FormResponseGuid] = @FormResponseGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormResponseDelete
(
@FormResponseGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [FormResponse]
WHERE 
[FormResponseGuid] = @FormResponseGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormulaSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormulaSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormulaInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormulaInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormulaUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormulaUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormulaDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormulaDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgFormulaSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgFormulaSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormulaSelect
(
@FormulaGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @FormulaGuid IS NULL BEGIN
	SELECT	[FormulaGuid], [CreatedBy], [CreatedOn], [Description], [EditedBy],
			[EditedOn], [Name], [SyncTime]
	FROM [Formula]
END ELSE BEGIN
	SELECT	[FormulaGuid], [CreatedBy], [CreatedOn], [Description], [EditedBy],
			[EditedOn], [Name], [SyncTime]
	FROM [Formula]
	WHERE 
	[FormulaGuid] = @FormulaGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormulaInsert
(
@FormulaGuid	UNIQUEIDENTIFIER,
@CreatedBy	UNIQUEIDENTIFIER,
@CreatedOn	DATETIME,
@Description	NVARCHAR(255) = null,
@EditedBy	UNIQUEIDENTIFIER = null,
@EditedOn	DATETIME = null,
@Name	NVARCHAR(50),
@SyncTime	DATETIME = null)
AS
INSERT [Formula]
	([FormulaGuid], [CreatedBy], [CreatedOn], [Description], [EditedBy], [EditedOn], [Name], [SyncTime])
VALUES
(@FormulaGuid, @CreatedBy, @CreatedOn, @Description, @EditedBy, @EditedOn, @Name, @SyncTime)

SELECT @FormulaGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormulaUpdate
(
@FormulaGuid	UNIQUEIDENTIFIER, 
@CreatedBy	UNIQUEIDENTIFIER, 
@CreatedOn	DATETIME, 
@Description	NVARCHAR(255) = null, 
@EditedBy	UNIQUEIDENTIFIER = null, 
@EditedOn	DATETIME = null, 
@Name	NVARCHAR(50), 
@SyncTime	DATETIME = null
)
AS
UPDATE [Formula]
SET	[CreatedBy] = @CreatedBy, 
	[CreatedOn] = @CreatedOn, 
	[Description] = @Description, 
	[EditedBy] = @EditedBy, 
	[EditedOn] = @EditedOn, 
	[Name] = @Name, 
	[SyncTime] = @SyncTime
WHERE 
[FormulaGuid] = @FormulaGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgFormulaDelete
(
@FormulaGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [Formula]
WHERE 
[FormulaGuid] = @FormulaGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgLocalizedStringSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgLocalizedStringSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgLocalizedStringInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgLocalizedStringInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgLocalizedStringUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgLocalizedStringUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgLocalizedStringDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgLocalizedStringDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgLocalizedStringSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgLocalizedStringSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgLocalizedStringSelect
(
@LocalizedStringGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @LocalizedStringGuid IS NULL BEGIN
	SELECT	[LocalizedStringGuid], [Category], [ISOCode], [Key], [Value]
	FROM [LocalizedString]
END ELSE BEGIN
	SELECT	[LocalizedStringGuid], [Category], [ISOCode], [Key], [Value]
	FROM [LocalizedString]
	WHERE 
	[LocalizedStringGuid] = @LocalizedStringGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgLocalizedStringInsert
(
@LocalizedStringGuid	UNIQUEIDENTIFIER,
@Category	VARCHAR(50) = null,
@ISOCode	VARCHAR(20),
@Key	VARCHAR(50),
@Value	NVARCHAR(1024))
AS
INSERT [LocalizedString]
	([LocalizedStringGuid], [Category], [ISOCode], [Key], [Value])
VALUES
(@LocalizedStringGuid, @Category, @ISOCode, @Key, @Value)

SELECT @LocalizedStringGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgLocalizedStringUpdate
(
@LocalizedStringGuid	UNIQUEIDENTIFIER, 
@Category	VARCHAR(50) = null, 
@ISOCode	VARCHAR(20), 
@Key	VARCHAR(50), 
@Value	NVARCHAR(1024)
)
AS
UPDATE [LocalizedString]
SET	[Category] = @Category, 
	[ISOCode] = @ISOCode, 
	[Key] = @Key, 
	[Value] = @Value
WHERE 
[LocalizedStringGuid] = @LocalizedStringGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgLocalizedStringDelete
(
@LocalizedStringGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [LocalizedString]
WHERE 
[LocalizedStringGuid] = @LocalizedStringGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgOperationSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgOperationSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgOperationInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgOperationInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgOperationUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgOperationUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgOperationDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgOperationDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgOperationSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgOperationSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgOperationSelect
(
@OperationGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @OperationGuid IS NULL BEGIN
	SELECT	[OperationGuid], [Description], [Name]
	FROM [Operation]
END ELSE BEGIN
	SELECT	[OperationGuid], [Description], [Name]
	FROM [Operation]
	WHERE 
	[OperationGuid] = @OperationGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgOperationInsert
(
@OperationGuid	UNIQUEIDENTIFIER,
@Description	NVARCHAR(50),
@Name	NVARCHAR(50))
AS
INSERT [Operation]
	([OperationGuid], [Description], [Name])
VALUES
(@OperationGuid, @Description, @Name)

SELECT @OperationGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgOperationUpdate
(
@OperationGuid	UNIQUEIDENTIFIER, 
@Description	NVARCHAR(50), 
@Name	NVARCHAR(50)
)
AS
UPDATE [Operation]
SET	[Description] = @Description, 
	[Name] = @Name
WHERE 
[OperationGuid] = @OperationGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgOperationDelete
(
@OperationGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [Operation]
WHERE 
[OperationGuid] = @OperationGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgPropositionSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgPropositionSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgPropositionInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgPropositionInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgPropositionUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgPropositionUpdate]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgPropositionDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgPropositionDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[UIFX].[spgPropositionSync]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [UIFX].[spgPropositionSync]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgPropositionSelect
(
@PropositionGuid	UNIQUEIDENTIFIER = NULL
)
AS

IF @PropositionGuid IS NULL BEGIN
	SELECT	[PropositionGuid], [ConjunctionGuid], [CreatedBy], [CreatedOn], [EditedBy],
			[EditedOn], [EndGroup], [FormField1Guid], [FormField2Guid],
			[FormulaGuid], [OperationGuid], [Order], [StartGroup],
			[SyncTime], [Value2]
	FROM [Proposition]
END ELSE BEGIN
	SELECT	[PropositionGuid], [ConjunctionGuid], [CreatedBy], [CreatedOn], [EditedBy],
			[EditedOn], [EndGroup], [FormField1Guid], [FormField2Guid],
			[FormulaGuid], [OperationGuid], [Order], [StartGroup],
			[SyncTime], [Value2]
	FROM [Proposition]
	WHERE 
	[PropositionGuid] = @PropositionGuid
END
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgPropositionInsert
(
@PropositionGuid	UNIQUEIDENTIFIER,
@ConjunctionGuid	UNIQUEIDENTIFIER = null,
@CreatedBy	UNIQUEIDENTIFIER,
@CreatedOn	DATETIME,
@EditedBy	UNIQUEIDENTIFIER = null,
@EditedOn	DATETIME = null,
@EndGroup	BIT,
@FormField1Guid	UNIQUEIDENTIFIER,
@FormField2Guid	UNIQUEIDENTIFIER = null,
@FormulaGuid	UNIQUEIDENTIFIER,
@OperationGuid	UNIQUEIDENTIFIER,
@Order	INT,
@StartGroup	BIT,
@SyncTime	DATETIME = null,
@Value2	NVARCHAR(50) = null)
AS
INSERT [Proposition]
	([PropositionGuid], [ConjunctionGuid], [CreatedBy], [CreatedOn], [EditedBy], [EditedOn], [EndGroup], [FormField1Guid], [FormField2Guid], [FormulaGuid], [OperationGuid], [Order], [StartGroup], [SyncTime], [Value2])
VALUES
(@PropositionGuid, @ConjunctionGuid, @CreatedBy, @CreatedOn, @EditedBy, @EditedOn, @EndGroup, @FormField1Guid, @FormField2Guid, @FormulaGuid, @OperationGuid, @Order, @StartGroup, @SyncTime, @Value2)

SELECT @PropositionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgPropositionUpdate
(
@PropositionGuid	UNIQUEIDENTIFIER, 
@ConjunctionGuid	UNIQUEIDENTIFIER = null, 
@CreatedBy	UNIQUEIDENTIFIER, 
@CreatedOn	DATETIME, 
@EditedBy	UNIQUEIDENTIFIER = null, 
@EditedOn	DATETIME = null, 
@EndGroup	BIT, 
@FormField1Guid	UNIQUEIDENTIFIER, 
@FormField2Guid	UNIQUEIDENTIFIER = null, 
@FormulaGuid	UNIQUEIDENTIFIER, 
@OperationGuid	UNIQUEIDENTIFIER, 
@Order	INT, 
@StartGroup	BIT, 
@SyncTime	DATETIME = null, 
@Value2	NVARCHAR(50) = null
)
AS
UPDATE [Proposition]
SET	[ConjunctionGuid] = @ConjunctionGuid, 
	[CreatedBy] = @CreatedBy, 
	[CreatedOn] = @CreatedOn, 
	[EditedBy] = @EditedBy, 
	[EditedOn] = @EditedOn, 
	[EndGroup] = @EndGroup, 
	[FormField1Guid] = @FormField1Guid, 
	[FormField2Guid] = @FormField2Guid, 
	[FormulaGuid] = @FormulaGuid, 
	[OperationGuid] = @OperationGuid, 
	[Order] = @Order, 
	[StartGroup] = @StartGroup, 
	[SyncTime] = @SyncTime, 
	[Value2] = @Value2
WHERE 
[PropositionGuid] = @PropositionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/**************************************************
 *  This stored procedure was created by 
 *  PDO Generator version 2.3
 **************************************************/
CREATE PROCEDURE [UIFX].spgPropositionDelete
(
@PropositionGuid	UNIQUEIDENTIFIER
)
AS
DELETE FROM [Proposition]
WHERE 
[PropositionGuid] = @PropositionGuid
GO

SET QUOTED_IDENTIFIER OFF

GO
SET ANSI_NULLS ON
GO

